package com.ssm.design;

import com.ssm.design.chain.OrderHandlerChain;
import com.ssm.design.chain.context.OrderHandleContext;
import com.ssm.design.chain.context.OrderHandleContextV3;
import com.ssm.design.chain.handler.AbstractHandler;
import com.ssm.design.chain.handler.VipOrderHandler;
import com.ssm.design.chain.handler.v3.AbstractOrderHandlerV3;
import com.ssm.design.chain.handler.v3.CreateOrderHandler;
import com.ssm.design.chain.handler.v3.RebateOrderHandler;
import com.ssm.design.common.enums.OrderTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;


@SpringBootApplication
public class App {

    public static void main(String[] args) {
        SpringApplication.run(App.class);
    }

    @Bean
    @Order(Integer.MAX_VALUE - 1)
    public AbstractHandler vipOrderHandler2() {
        return new VipOrderHandler() {
            @Override
            public void doHandle(OrderHandleContext context, OrderHandlerChain chain) {
                System.out.println("----> " +
                        getApplicationContext().getApplicationName());
            }
        };
    }



}
